import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { PageSelecter } from "../../common/pageSelect/PageSelecter";
import { CrossSeaEnterRender } from "./render/CrossSeaEnterRender";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { GTileList } from "../../../../../com/mui/controls/GTileList";
type int = number;
//class CrossSeaEnterWin
    
    export  class CrossSeaEnterWin extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            setSize(679, 424);
            titleHeight = 27;
            title = Language.getString(80441);
            this._pageSelecter.addEventListener(flash.events.Event.CHANGE, this.pageChangeHandler);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(18, 38, 643, 337, this);
            this._pageSelecter = ObjCreate.createPageSelecter(278, 334, this, PageSelecter.CompleteMode);
            this._list = ObjCreate.createTileList(30, 60, 650, 280, this);
            this._list.rowHeight = 125;
            this._list.columnWidth = 126;
            this._list.setStyle("cellRenderer", CrossSeaEnterRender);
            var loc1=GlobalStyle.textFormat1;
            loc1.color = 65280;
            var loc2=ObjCreate.createGTextField(Language.getString(80454), 49, 383, 588, 60, this, loc1);
            loc2.wordWrap = true;
            loc2.multiline = true;
            loc2.text = Language.getString(80454);
            return;
        }

        public set data(arg1: Array<any>)
        {
            if (arg1 == null || arg1.length == 0) 
            {
                return;
            }
            this._data = arg1;
            this._pageSelecter.currentPage = 1;
            this._pageSelecter.maxPage = Math.ceil(this._data.length / numPerPage);
            this.pageChangeHandler(null);
            return;
        }

        /* internal  */pageChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            var loc1=this._pageSelecter.currentPage;
            var loc2=this._data.length;
            var loc3;
            loc2 = (loc3 = (loc1 - 1) * CrossSeaEnterWin.numPerPage) + CrossSeaEnterWin.numPerPage < loc2 ? loc3 + CrossSeaEnterWin.numPerPage : loc2;
            var loc4=[];
            while (loc3 < loc2) 
            {
                loc4.push(this._data[loc3]);
                ++loc3;
            }
            this._list.dataProvider = new DataProvider(loc4);
            this._list.drawNow();
            return;
        }

        public static /* const */numPerPage: int=10;

        /* internal */ /* var */_pageSelecter: PageSelecter;

        /* internal */ /* var */_data: Array<any>;

        /* internal */ /* var */_list: GTileList;
    }
